home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / delay / ch_delay.c next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  3.3 KB  |  130 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3. /*
  4.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  5.  *
  6.  *
  7.  *     Copyright (C) 1979,1980,1981  University of Delaware
  8.  *
  9.  *     Department of Electrical Engineering
  10.  *     University of Delaware
  11.  *     Newark, Delaware  19711
  12.  *
  13.  *     Phone:  (302) 738-1163
  14.  *
  15.  *
  16.  *     This program module was developed as part of the University
  17.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  18.  *
  19.  *     Acquisition, use, and distribution of this module and its listings
  20.  *     are subject restricted to the terms of a license agreement.
  21.  *     Documents describing systems using this module must cite its source.
  22.  *
  23.  *     The above statements must be retained with all copies of this
  24.  *     program and may not be removed without the consent of the
  25.  *     University of Delaware.
  26.  *
  27.  *
  28.  *     version  -1    David H. Crocker    March   1979
  29.  *     version   0    David H. Crocker    April   1980
  30.  *     version  v7    David H. Crocker    May     1981
  31.  *     version   1    David H. Crocker    October 1981
  32.  *
  33.  */
  34.  
  35. /*                  DELAYED PROCESSING CHANNEL                          */
  36. /*                  hacked up from the list channel Phil UCL Nov85      */
  37.  
  38. #include <signal.h>
  39. #include "phs.h"
  40. #include "ch.h"
  41.  
  42. extern char *dupfpath();
  43. extern LLog *logptr;
  44.  
  45. Chan *chanptr;
  46. char obuf[BUFSIZ];           /* Buffer for status printfs */
  47.  
  48. /*      MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN     */
  49.  
  50. main (argc, argv)
  51. int       argc;
  52. char   *argv[];
  53. {
  54.     short retval;
  55.  
  56.     mmdf_init (argv[0]);
  57.     setbuf( stdout, obuf );
  58.  
  59. #ifdef RUNALON
  60.     logptr -> ll_fd = 1;
  61.     ll_init (logptr);
  62. #endif
  63.  
  64.     siginit ();
  65.     signal (SIGINT, SIG_IGN);     /* always ignore interrupts             */
  66.  
  67.     if ((chanptr = ch_nm2struct (argv[0])) == (Chan *) NOTOK)
  68.     {
  69.     ll_log (logptr, LLOGTMP, "delayproc (%s) unknown channel", argv[0]);
  70.     exit (RP_PARM);
  71.     }
  72.     retval = ch_delay (argc, argv);
  73.     ll_close (logptr);
  74.     exit (retval);
  75. }
  76. /* **************  (ch_) DELAYED SUBMISSION DELIVERY  ***************** */
  77.  
  78. ch_delay (argc, argv)              /* send to internet                   */
  79. int       argc;
  80. char   *argv[];
  81. {
  82.     ch_llinit (chanptr);
  83. #ifdef DEBUG
  84.     ll_log (logptr, LLOGBTR, "ch_delay()");
  85. #endif
  86.  
  87.     if (rp_isbad (qu_init (argc, argv)))
  88.     return (RP_NO);           /* problem setting-up for deliver     */
  89.  
  90.     phs_note (chanptr, PHS_WRSTRT);
  91.  
  92.     if (rp_isbad (qu2ds_send ()))
  93.     return (RP_NO);           /* send the batch of outgoing mail    */
  94.  
  95.     phs_note (chanptr, PHS_WREND);
  96.  
  97.     qu_end (OK);                  /* done with Deliver function         */
  98.  
  99.     return (RP_OK);               /* NORMAL RETURN                      */
  100. }
  101.  
  102. /* */
  103.  
  104. /* VARARGS2 */
  105. err_abrt (code, fmt, b, c, d)     /* terminate ourself                  */
  106. short     code;
  107. char    fmt[],
  108.     b[],
  109.     c[],
  110.     d[];
  111. {
  112. #ifdef DEBUG
  113.     char linebuf[LINESIZE];
  114. #endif
  115.  
  116.     qu_end (NOTOK);
  117.  
  118. #ifdef DEBUG
  119.     if (rp_gbval (code) == RP_BNO || logptr -> ll_level >= LLOGBTR)
  120.     {                         /* don't worry about minor stuff      */
  121.     sprintf (linebuf, "%s%s", "err [ ABEND (%s) ]\t", fmt);
  122.     ll_log (logptr, LLOGFAT, linebuf, rp_valstr (code), b, c, d);
  123.     abort ();
  124.     }
  125. #endif
  126.     ll_close (logptr);            /* in case of cycling, close neatly   */
  127.  
  128.     exit (code);
  129. }
  130.